# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: speps <speps dot aur dot archlinux dot org>

pkgname=harvid
pkgver=0.9.1
pkgrel=2
pkgdesc="HTTP Ardour Video Daemon"
arch=(loong64 x86_64)
url="https://x42.github.io/harvid/"
license=(GPL2)
depends=(glibc libpng)
makedepends=(ffmpeg libjpeg-turbo xxd)
source=(https://github.com/x42/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('9a848078adeb1cc5730e21fac18acb5965fadf903dead52dcf805112938fc975d010cc5b651cdc87265e10c209273cb3a1a8c8ec64f9f2613640638747832466')
b2sums=('18e72df0330f3d7bd420b95610b23cb582db32b427e5bacec74c43312742dd7de0dd4829bdbb7841f5e0ca62d11c0361b83efb6b6221da0ecb328d8efe28de29')

build() {
  make -j1 -C $pkgname-$pkgver
}

package() {
  depends+=(
    ffmpeg libavcodec.so libavformat.so libavutil.so libswscale.so
    libjpeg-turbo libjpeg.so
  )

  make PREFIX=/usr DESTDIR="$pkgdir" install -C $pkgname-$pkgver

  # ffmpeg and ffprobe symlinks (for ardour)
  ln -sv ffmpeg "$pkgdir/usr/bin/ffmpeg_$pkgname"
  ln -sv ffprobe "$pkgdir/usr/bin/ffprobe_$pkgname"

  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README.md} -t "$pkgdir/usr/share/doc/$pkgname/"
}
